package testingPackage;


public class minimax 
{
	public static final int ROWS = 8, COLS = 8;
	public static int[][] board = new int[ROWS][COLS];
	
	public static void main(String[] args)
	{
		newBoard();
		
		//display board
		for (int i = 0; i < ROWS; i++)
		{			
			for (int j = 0; j < COLS; j++)
				System.out.print(" " + board[i][j] + " ");
			
			System.out.print("\n");
		}
		
		System.out.print("\n");
		System.out.print("\n");
		
		minimax();
		
		
	}
	
	public static void newBoard()
	{
		// first row
		board[0][0] = 5;
		board[0][1] = 2;
		board[0][2] = 3;
		board[0][3] = 1;
		board[0][4] = 4;
		board[0][5] = 0;
		board[0][6] = 2;
		board[0][7] = 2;
		
		// second row
		board[1][0] = 3;
		board[1][1] = 4;
		board[1][2] = 5;
		board[1][3] = 6;
		board[1][4] = 7;
		board[1][5] = 2;
		board[1][6] = 1;
		board[1][7] = 1;
		
		// third row
		board[2][0] = 3;
		board[2][1] = 4;
		board[2][2] = 5;
		board[2][3] = 6;
		board[2][4] = 7;
		board[2][5] = 2;
		board[2][6] = 1;
		board[2][7] = 1;
		
		// fourth row
		board[3][0] = 3;
		board[3][1] = 4;
		board[3][2] = 5;
		board[3][3] = 6;
		board[3][4] = 7;
		board[3][5] = 2;
		board[3][6] = 1;
		board[3][7] = 1;
		
		// 5th row
		board[4][0] = 3;
		board[4][1] = 4;
		board[4][2] = 5;
		board[4][3] = 6;
		board[4][4] = 7;
		board[4][5] = 2;
		board[4][6] = 1;
		board[4][7] = 1;
		
		// 6th row
		board[5][0] = 3;
		board[5][1] = 4;
		board[5][2] = 5;
		board[5][3] = 6;
		board[5][4] = 7;
		board[5][5] = 2;
		board[5][6] = 1;
		board[5][7] = 1;
		
		// 7th row
		board[6][0] = 3;
		board[6][1] = 4;
		board[6][2] = 5;
		board[6][3] = 6;
		board[6][4] = 7;
		board[6][5] = 2;
		board[6][6] = 1;
		board[6][7] = 1;
		
		// 8th row
		board[7][0] = 3;
		board[7][1] = 4;
		board[7][2] = 5;
		board[7][3] = 6;
		board[7][4] = 7;
		board[7][5] = 2;
		board[7][6] = 1;
		board[7][7] = 1;
				
	}
	
	public static void minimax()
	{
		//assume max goes first
		
		int theMax = board[0][0];
		int row = 0;
		int col = 0;
		
		//check first column - A
		for (int j = 0; j < ROWS; j++)
		{
			if (theMax < board[j][0])
			{
				theMax = board[j][0];
				row = j;
				col = 0;
			}
		}
		
		//check last - H
		for (int j = 0; j < ROWS; j++)
		{
			if (theMax < board[j][0])
			{
				theMax = board[j][0];
				row = j;
				col = 0;
			}
		}
		
		System.out.print("First Move - Max chooses " + theMax + " at  board[" +row+ "][" +col+ "] \n");
	}
}
